package com.bs.blogspace.mapper;

import com.bs.blogspace.pojo.Comment;
import org.apache.ibatis.annotations.*;

import java.util.List;


@Mapper
public interface CommentMapper {
    //查询评论
    @Select("SELECT * FROM comment where essay_id=#{eassayId}")
    List<Comment> queryAll(int essayId);

    // 添加评论信息
    @Insert("insert into comment(essay_id,user_name,phone,content,type,comment_user_name,comment_time)" +
            "values (#{essayId},#{userName},#{phone},#{content},#{type},#{commentUserName},#{commentTime})")
    int addComment(Comment comment);

    //删除评论
    @Delete("delete from comment where comment_id=#{commentId}")
    int deleteComment(@Param("commentId") String commentId);

}
